// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;

namespace Microsoft.AspNetCore.Routing
{
    internal sealed class ConfigureRouteHandlerOptions : IConfigureOptions<RouteHandlerOptions>
    {
        private readonly IHostEnvironment _environment;

        public ConfigureRouteHandlerOptions(IHostEnvironment environment)
        {
            _environment = environment;
        }

        public void Configure(RouteHandlerOptions options)
        {
            if (_environment.IsDevelopment())
            {
                options.ThrowOnBadRequest = true;
            }
        }
    }
}
